// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.2.1

package ru.fizteh.fivt.demo.calc;

public abstract class _CalcNumberDisp extends Ice.ObjectImpl implements CalcNumber
{
    protected void
    ice_copyStateFrom(Ice.Object __obj)
        throws java.lang.CloneNotSupportedException
    {
        throw new java.lang.CloneNotSupportedException();
    }

    public static final String[] __ids =
    {
        "::Ice::Object",
        "::demo::calc::CalcNumber"
    };

    public boolean
    ice_isA(String s)
    {
        return java.util.Arrays.binarySearch(__ids, s) >= 0;
    }

    public boolean
    ice_isA(String s, Ice.Current __current)
    {
        return java.util.Arrays.binarySearch(__ids, s) >= 0;
    }

    public String[]
    ice_ids()
    {
        return __ids;
    }

    public String[]
    ice_ids(Ice.Current __current)
    {
        return __ids;
    }

    public String
    ice_id()
    {
        return __ids[1];
    }

    public String
    ice_id(Ice.Current __current)
    {
        return __ids[1];
    }

    public static String
    ice_staticId()
    {
        return __ids[1];
    }

    public final ru.fizteh.fivt.demo.ntypes.MyNumber
    add(ru.fizteh.fivt.demo.ntypes.MyNumber x, ru.fizteh.fivt.demo.ntypes.MyNumber y)
        throws ru.fizteh.fivt.demo.ntypes.MyNumberFormatException
    {
        return add(x, y, null);
    }

    public final ru.fizteh.fivt.demo.ntypes.MyNumber
    div(ru.fizteh.fivt.demo.ntypes.MyNumber x, ru.fizteh.fivt.demo.ntypes.MyNumber y)
        throws DivByZeroException,
               ru.fizteh.fivt.demo.ntypes.MyNumberFormatException
    {
        return div(x, y, null);
    }

    public final ru.fizteh.fivt.demo.ntypes.MyNumber
    mult(ru.fizteh.fivt.demo.ntypes.MyNumber x, ru.fizteh.fivt.demo.ntypes.MyNumber y)
        throws ru.fizteh.fivt.demo.ntypes.MyNumberFormatException
    {
        return mult(x, y, null);
    }

    public static IceInternal.DispatchStatus
    ___add(CalcNumber __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder x = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(x.getPatcher());
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder y = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(y.getPatcher());
        __is.readPendingObjects();
        try
        {
            ru.fizteh.fivt.demo.ntypes.MyNumber __ret = __obj.add(x.value, y.value, __current);
            __os.writeObject(__ret);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(ru.fizteh.fivt.demo.ntypes.MyNumberFormatException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___mult(CalcNumber __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder x = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(x.getPatcher());
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder y = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(y.getPatcher());
        __is.readPendingObjects();
        try
        {
            ru.fizteh.fivt.demo.ntypes.MyNumber __ret = __obj.mult(x.value, y.value, __current);
            __os.writeObject(__ret);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(ru.fizteh.fivt.demo.ntypes.MyNumberFormatException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___div(CalcNumber __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder x = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(x.getPatcher());
        ru.fizteh.fivt.demo.ntypes.MyNumberHolder y = new ru.fizteh.fivt.demo.ntypes.MyNumberHolder();
        __is.readObject(y.getPatcher());
        __is.readPendingObjects();
        try
        {
            ru.fizteh.fivt.demo.ntypes.MyNumber __ret = __obj.div(x.value, y.value, __current);
            __os.writeObject(__ret);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(DivByZeroException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
        catch(ru.fizteh.fivt.demo.ntypes.MyNumberFormatException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    private final static String[] __all =
    {
        "add",
        "div",
        "ice_id",
        "ice_ids",
        "ice_isA",
        "ice_ping",
        "mult"
    };

    public IceInternal.DispatchStatus
    __dispatch(IceInternal.Incoming in, Ice.Current __current)
    {
        int pos = java.util.Arrays.binarySearch(__all, __current.operation);
        if(pos < 0)
        {
            return IceInternal.DispatchStatus.DispatchOperationNotExist;
        }

        switch(pos)
        {
            case 0:
            {
                return ___add(this, in, __current);
            }
            case 1:
            {
                return ___div(this, in, __current);
            }
            case 2:
            {
                return ___ice_id(this, in, __current);
            }
            case 3:
            {
                return ___ice_ids(this, in, __current);
            }
            case 4:
            {
                return ___ice_isA(this, in, __current);
            }
            case 5:
            {
                return ___ice_ping(this, in, __current);
            }
            case 6:
            {
                return ___mult(this, in, __current);
            }
        }

        assert(false);
        return IceInternal.DispatchStatus.DispatchOperationNotExist;
    }

    public void
    __write(IceInternal.BasicStream __os)
    {
        __os.writeTypeId(ice_staticId());
        __os.startWriteSlice();
        __os.endWriteSlice();
        super.__write(__os);
    }

    public void
    __read(IceInternal.BasicStream __is, boolean __rid)
    {
        if(__rid)
        {
            __is.readTypeId();
        }
        __is.startReadSlice();
        __is.endReadSlice();
        super.__read(__is, true);
    }

    public void
    __write(Ice.OutputStream __outS)
    {
        Ice.MarshalException ex = new Ice.MarshalException();
        ex.reason = "type demo::calc::CalcNumber was not generated with stream support";
        throw ex;
    }

    public void
    __read(Ice.InputStream __inS, boolean __rid)
    {
        Ice.MarshalException ex = new Ice.MarshalException();
        ex.reason = "type demo::calc::CalcNumber was not generated with stream support";
        throw ex;
    }
}
